#pragma once
#include"List_iterator.h"
namespace my {
	template <typename T>
	class List {
	public:
		using iterator = List_iterator<T>;
		List() :head(new List_node<T>()), tail(new List_node<T>()), size(0) { head->next = tail; tail->privious = head; }
		~List() { delete head; delete tail; }

		void push_back(T data) {
			List_node<T>* temp = new List_node<T>(data);
			temp->next = tail;
			temp->privious = tail->privious;
			tail->privious->next = temp;
			tail->privious = temp;
			size++;
		}

		List_iterator<T> begin() { return List_iterator<T>(head->next); }
		List_iterator<T> end() { return List_iterator<T>(tail); }
	private:
		List_node<T>* head;
		List_node<T>* tail;
		int size;
	};
}